Automatic rotation, cropping and scaling of images for printing

ABSTRACT

A method for automatically cropping, rotating, and scaling a scanned image to ensure that a printed copy of the scanned image is the same size as the original, when possible. The method attempts to honor the default or operator designated orientation of the printed image, but will automatically rotate the image if that will eliminate unnecessary image reduction. Optimal orientation and scaling factors are automatically determined based on the target page size and the size and shape of the information of interest in the original image (not the boundaries of the original document). The operator selects a desired printed orientation (or accepts a default orientation) and selects a desired printed paper size (or accepts a default printed paper size). If an image will fit within the printable margins without rotation or cropping, the image is simply printed without modification. If the image will fit without rotation by cropping white space, then white space is cropped. If the image with all white space cropped will still not fit, the image is oriented so that long sides on the cropped image align with long sides on the printed paper. If the cropped and rotated image still does not fit, the cropped image is scaled to fit within the printable margins and the image is oriented so that long sides on the cropped image align with long sides on the printed paper.

FIELD OF INVENTION

This invention relates generally to printing copies of documents thathave been scanned by optical scanners, digital cameras, facsimilemachines, digital photocopiers, or other digital imaging devices, andmore specifically to an automatic method of rotating, cropping andscaling of images for printing.

BACKGROUND OF THE INVENTION

Photocopiers typically require the operator to properly orient theoriginal document and may require the operator to select the properpaper bin. For example, for landscape mode, the operator typically mustorient the original document in a landscape orientation and select apaper bin having paper in a landscape orientation. Similarly, whenprinting a scanned image from a computer, the operator typically mustspecify orientation of the image on the page. If an operator makes aninappropriate choice, resources such as toner, paper, and time may bewasted if the photocopier prints pages that are not useful or not whatwas expected.

Photocopiers also typically require an operator to input or choose ascale factor to reduce oversized images to fit onto the output page orto magnify small images to fit onto the output page. Some photocopiersmay provide an automatic scaling feature, in which the printed documentsize is automatically scaled based on the dimensions of the edges of theoriginal document.

Photocopiers typically can print to the edges of the output page. Incontrast, many computer software applications, for example wordprocessing software, force unprintable margins around the edges of apage. In addition, many computer software applications automaticallyscale an image to fit inside the unprintable margins. Consider an image,including printed text, that is scanned by a document scanner. Assumethat the scanned image includes white space around the edges. If thatscanned image is imported into a word processor and reprinted, wordprocessing software will typically reduce the image, including thescanned margins, to fit within the printable area of a page. The netresult is that the printed text is reduced in size.

In some situations, the primary goal is a printed page with an image ofinterest that is as large as possible. There is a need for additionalautomation in optimizing the printed size of a scanned image.

SUMMARY OF THE INVENTION

One goal of the present invention is make the printed image the samesize as the original image (or slightly larger) when possible. Themethod attempts to honor the default or operator designated orientationof the printed image, but will automatically rotate the image if thatwill eliminate unnecessary image reduction. Optimal orientation andscaling factors are automatically determined based on the target pagesize and the size and shape of the original image (not the boundaries ofthe original document). The operator selects a desired printedorientation (or accepts a default orientation) and selects a desiredprinted paper size (or accepts a default printed paper size). If animage will fit within the printable margins without rotation orcropping, the image is simply printed without modification. If there iswhite space that can be cropped, and if the image will fit withoutrotation by cropping white space, then white space is cropped. If theimage with all white space cropped will still not fit, and if the imageis not oriented so that long sides on the cropped image align with longsides on the printed paper, then the image is rotated. If the croppedand rotated image still does not fit, the cropped and rotated image isscaled to fit within the printable margins and the image is oriented sothat long sides on the cropped image align with long sides on theprinted paper.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A is a plan view of a scanned document with white margins.

FIG. 1B is a plan view of the scanned document of FIG. 1A reduced withinprintable margins of a printed page.

FIG. 1C is a plan view of the scanned document of FIG. 1A, printedwithin printable margins of a printed page, without reduction but withcropped margins.

FIG. 2A is a plan view of a scanned document.

FIG. 2B is a plan view of the document of FIG. 2A cropped and rotatedand printed within printable margins of a printed page.

FIG. 3 is flow chart of a method of cropping, rotating and scaling inaccordance with the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT OF THE INVENTION

FIG. 1A illustrates an image 100 resulting from scanning a textdocument. Dashed line 102 is not part of the image, but instead depictsa rectangular boundary between a margin 104 containing only “whitespace” and non-white information of interest 106, which in this exampleimage is text.

FIG. 1B illustrates the typical situation when image 100 is printedusing computer software. Dashed line 108 depicts the printable area onthe page as determined by printer hardware, and known by the computersoftware. Often, computer software will avoid clipping an image, andinstead will scale an image to fit within the printable area of a page.In FIG. 1B, image 100 has been slightly reduced by the computer softwareso that the entire scanned image 100, including the margins 104, isprinted within the printable area depicted by line 108. Specifically,for text as illustrated in FIG. 1A, the text in FIG. 1B is smaller thanthe text in FIG. 1A.

FIG. 1C illustrates a first aspect of a method in accordance with thepresent invention, which is to digitally crop the image before sendingthe image to a printer or to software for printing, so that theresulting information of interest 106 (text in the example) in FIG. 1Cis the same size as (or larger than) the corresponding information ofinterest in FIG. 1A. One approach is to simply always crop (deletemargin data) the entire margin 104 of FIG. 1A so that the information ofinterest 106 in FIG. 1C extends to the edges of the printable areadepicted by line 108. If a large margin is entirely cropped, the imageof interest may be enlarged if sent to software for printing.Alternatively, if the goal is to always keep the printed image the samesize as the original image of interest, sufficient margin may be croppedto keep the printed image the same size as the original even if sent tosoftware for printing. If the cropped image is to be sent direct to aprinter, printers typically do not scale, so that full cropping willstill result in the printed image of interest having the same size asthe original image of interest. If margins are completely cropped, theimage of interest is then preferably centered horizontally andvertically within the printed page. One reason for centering is to avoidprinting the image of interest in the upper left corner where a staplemay interfere. Note that some images may not have any white space to becropped, and some images may have a lot of white space, only some ofwhich needs to be cropped. In general, if white space is present,sufficient cropping is performed to make the resulting cropped imagefit, if possible.

FIG. 2A illustrates a scanned image 200 that includes non-white imagearea of interest (for example, scanned text) 202, where the informationof interest 202 is wider than the shortest dimension of the printablearea depicted by line 108 in FIGS. 1B and 1C. That is, if image 200 isprinted onto a page in portrait orientation, the image must be reducedor some of the information of interest 202 will be cropped duringprinting. In the present application, automatic rotation is preferableto scaling or cropping of information of interest in the image.Accordingly, if image 200 will not fit, even after cropping, within theprintable area in its original orientation, and if the longest dimensionof the rectangular non-white image 200 is not aligned with the longestdimension of a rectangular printable area, then the image is rotated. Ifthe longest dimension of the rectangular non-white image 200 is alreadyaligned with the longest dimension of a rectangular printable area, thenno rotation is performed.

In FIG. 2B, image 200 has been cropped (to remove white space marginsonly) and rotated so that the longest dimension of the non-white image202 is aligned with the longest dimension of the printable area onprinted page 204. The non-white image 202 in FIG. 2B is the same size asnon-white image 202 within the original image 200 in FIG. 2A. Thenon-white image 202 is scaled only if it will not fit into the printablearea after cropping and rotation (if appropriate).

FIG. 3 is a flow chart of a method in accordance with the presentinvention. Before entry into the method of FIG. 3, a preferred printedorientation is selected (or a default orientation is accepted). Inaddition, a printed page size is selected (or a default page size isaccepted). Before entry into the method of FIG. 3, the image is orientedaccording to the selected orientation. At decision 300, if a scannedimage will fit, within the printable area, in the selected orientation,without cropping, rotating, or scaling, then the image is saved ortransferred without modification. Otherwise, at step 302, white-spacemargins (if available) are identified and cropped (margin data isdeleted), entirely or just to the extent necessary to make the imagefit. For examples of methods for automatic classification of variousareas of an image (to determine a rectangle defining the information ofinterest), see U.S. Pat. Nos. 5,280,367; 5,546,474; and 5,596,655. Atdecision 304, if the scanned image will fit, within the printable areain the selected orientation, after cropping but without rotation orscaling, then the image is saved or transferred without rotation orscaling. Otherwise, at decision 306, if the longest dimension on thecropped image does not align with the longest dimension of the printablearea on the printed paper, then the image is rotated ninety degrees(step 308). At decision 310, if the scanned image will fit, within theprintable area, after cropping and after rotation (if appropriate) butwithout scaling, then the image is saved or transferred without scaling.Otherwise, the image is scaled to fit at step 312.

One alternative goal of the present invention is make the non-whiteportion of the printed image the same size as the non-white informationof interest portion of the original image, when possible. If one pixelin the scanned image is printed as one pixel on the printed page, thenthe scanned image and the printed image need to have the sameresolution. Accordingly, at step 314, given the printer resolution, ifthe resolution of the scanned image is different than the resolution ofthe printer, the image resolution is adjusted (by interpolation,decimation, or both) to match the resolution of the printer. Forexample, if the resolution of the image is 300 pixels per inch and theresolution of the printer is 600 pixels per inch, the image pixels maybe interpolated to double the effective resolution. Alternatively, ifresolution of the image is 600 pixels per inch and the resolution of theprinter is 300 pixels per inch then the image pixels are decimated tohalve the effective resolution. For non-integral ratios, image pixelsmay be interpolated and then decimated to provide the proper resolution.

Some document scanners may be interfaced to a computer that in turn isinterfaced to a printer. In a configuration including a computer, theautomated cropping, rotation, and scaling may be performed by firmwarewithin the scanner or by software in the computer, or by firmware withinthe printer. Some document scanners may be directly interfaced to aprinter, so that a copy mode may be performed without an intermediatecomputer. In a direct connection, the automated cropping, rotation, andscaling may be performed by firmware within the scanner, or by firmwarewithin the printer.

The foregoing description of the present invention has been presentedfor purposes of illustration and description. It is not intended to beexhaustive or to limit the invention to the precise form disclosed, andother modifications and variations may be possible in light of the aboveteachings. The embodiment was chosen and described in order to bestexplain the principles of the invention and its practical application tothereby enable others skilled in the art to best utilize the inventionin various embodiments and various modifications as are suited to theparticular use contemplated. It is intended that the appended claims beconstrued to include other alternative embodiments of the inventionexcept insofar as limited by the prior art.

What is claimed is:
 1. A method of automatically modifying a scannedimage by a system, the method comprising the following steps: (a)determining, by the system, that the scanned image will not fit within aprintable area of a printed page; (b) determining, by the system, thatthe scanned image data includes margins that do not need to be printed;and (c) deleting, by the system, data corresponding to the margins ofthe scanned image.
 2. The method of claim 1 further comprising: (d)determining, by the system, that the scanned image after deleting margindata in step (c) will not fit within the printable area of the printedpage; and (e) rotating, by the system, the scanned image ninety-degrees.3. The method of claim 2 further comprising: (f) determining, by thesystem, that the scanned image will not fit within the printable area ofthe printed page even with cropping and rotating; and (g) scaling, bythe system, the scanned image to fit within the printable area of theprinted page.